import React from 'react'
import { View, StyleSheet, Text, ScrollView } from 'react-native'
import { ScaleS, ScaleT } from 'src/utils/ScreenUtil'
import BasePage from 'src/pageP/base/base-page'
import DeleteCompleteBtn from 'src/components/delete-complete-btn/DeleteCompleteBtn'
import CustomButton from '../../../components/button/CustomButton'

// 发送行为
class BaseManager extends BasePage {
  constructor (props) {
    super(props)
    this.state = {
      header: {}
    }
    this.showDeleteCompleteBtn = true
    this.showSaveBtn = true
    this.onComplete = this.onComplete.bind(this)
  }

  renderNavigationBarChild () {
    return this.showSaveBtn ? (
      <CustomButton style={styles.saveBtn} onPress={this.onSave}>
        <Text style={[styles.saveText, styles.saveTextEnable]}>
          保存
        </Text>
      </CustomButton>
    ) : null
  }

  onSave = () => {

  }

  childRender () {
    return (
      <View style={styles.container}>
        <View style={styles.scrollParentView}>
          <ScrollView contentContainerStyle={styles.scrollView}>
            <Text style={styles.titleLabel}>{this.titleText}</Text>
            {this.childContentRender()}
          </ScrollView>
        </View>
        {
          this.showDeleteCompleteBtn ? (
            <View style={styles.deleteCompleteBtnView}>
              <DeleteCompleteBtn
                hideDelete={true}
                completeText={this.completeText}
                onComplete={this.onComplete}
              />
            </View>
          ) : null
        }
      </View>
    )
  }

  childContentRender () {

  }

  onComplete () {

  }
}

export default BaseManager

const styles = StyleSheet.create({
  container: {
    flex: 1
  },
  titleLabel: {
    color: '#444444',
    fontSize: ScaleT(27),
    fontWeight: '500',
    marginTop: ScaleS(30),
    marginLeft: ScaleS(20)
  },
  scrollParentView: {
    flex: 1
  },
  scrollView: {
    // flex: 1,
    paddingBottom: ScaleS(90)
  },
  deleteCompleteBtnView: {
    position: 'absolute',
    left: ScaleS(20),
    right: ScaleS(20),
    bottom: 0,
    paddingBottom: ScaleS(20),
    backgroundColor: 'white'
  },
  saveBtn: {
    alignSelf: 'flex-end',
    marginRight: ScaleS(20)
  },
  saveText: {
    color: '#bbbbbb',
    fontSize: ScaleT(16),
    fontWeight: '400',
    paddingVertical: ScaleS(5),
    paddingLeft: ScaleS(5)
  },
  saveTextEnable: {
    color: '#000000'
  }
})
